#include "kit.h"
#include <iostream>
#include <stdarg.h>

using namespace std;
using namespace phnq::kit::xml;

static phnq::kit::log::Logger *log = phnq::kit::log::Logger::get("kit_test");

void log_test()
{
	cout << "kit test" << endl;
	
	phnq::kit::log::LoggerTime logTime = log->time();

	// phnq::kit::log::Logger::setLevel(phnq::kit::log::Logger::INFO);
	
	string n = "Patrick";
	log->debug("Hi there");
	log->info("what up %s? %i.", n.c_str(), 42);
	log->debug(logTime, "Bubba Gump...");
}

class XMLTestDelegate : public SAXHelperDelegate
{
	public:
		void startTag(string name, string path, map<string,string> attrs)
		{
			cout << "START: " << path << endl;
		}

		void endTag(string name, string path)
		{
			cout << "END: " << path << endl;
		}
		
		void charData(string data, string path)
		{
			cout << "DATA: " << path << "--" << data << endl;
		}
};

void xml_test(string base)
{
	cout << "xml_test" << endl;

	XMLTestDelegate d;
	SAXHelper saxHelper(&d);
	saxHelper.parse(base+"xml_doc.xml");
}


int main(int argc, char* argv[])
{
	string base(argv[0]);
	base += "/../";
	
	//xml_test(base);
	log_test();
}
